<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp"%>
<%
	//获取住院结算明细
		String syxh = input.getDesc("syxh","15842");//住院病人首页 的主键
	String date = input.getDesc("start_date","2018-02-21 00:00:00");//开始时间
	String endDa = input.getDesc("end_date","2018-02-21");//结束时间

	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
	SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMdd");
	String nowDate = sdf2.format(sdf.parse(date));
	String nowEndDa = sdf2.format(sdf.parse(endDa));
	
	String startDate = nowDate+"00:00:00";
	String endDate = nowEndDa+"23:59:59";
	DecimalFormat df = new DecimalFormat("######0.0000"); 
	String coloms = "zxrq as zxrq , ypmc as ypmc , ypgg as ypgg , ypdw as ypdw ,ypsl as ypsl ,ypdj as ypdj ,zfdj as zfdj , yhdj as yhdj ,zje as zje , zfje as zfje , yhje as yhje";
	
	List<Map> list = QBuilder.db("basedb").queryHql("select new map( "+coloms+" ) from ZY_BRFYMXK where jlzt =0 and syxh='"+syxh+"' and zxrq >'"+startDate+"' and zxrq <'"+endDate+"' order by zxrq ");
	SimpleDateFormat sdf3 = new SimpleDateFormat("yyyyMMddhh:mm:ss");
	SimpleDateFormat sdf4 = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
	double sumZje = 0;
	for(Map map : list){
		String zje = map.get("zje") != null ? map.get("zje").toString() : "0";
		
		sumZje +=Double.parseDouble(zje);
		
		String zxrq = map.get("zxrq") != null ? map.get("zxrq").toString() : "0";
		
		zxrq = sdf4.format(sdf3.parse(zxrq));
		map.put("zxrq",zxrq+"");
	}
	Map map = new HashMap();
	map.put("sumZje",df.format(sumZje)+"");
	map.put("list",list);
	
	
	Message msg = new Message();
	msg.put("errcode",0);
	msg.put("data",map);
	Tools.print(out,msg);
%>